﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<nelech.Models.DBModel.ForumResponse>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    פורום -
    <%= Model.category.title %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% Html.RenderPartial("ForumSearchControl"); %>
    <div id="left">
   
        <%Html.RenderAction("AdvertShowThree", "Advert", new { id = 7 });%>
   
    </div>
    <div id="main">
        <div>
            <h3>
                שו"ת -
                <%= Model.category.title %></h3>
            <h4>
                <%= Model.category.description %></h4>
        </div>

        <script language="javascript" type="text/javascript">

            function ShowText(id) {
                var e = document.getElementById("text" + id);
                e.style.display = e.style.display == "none" ? "block" : "none";
            }
            function ShowList(j) {
                var e = document.getElementById(j);
                e.style.display = e.style.display == "none" ? "block" : "none";
            } 
        </script>

        <div class="tguva">
          
        <%= Html.ActionLink("רשימת כל הנושאים", "ListFirstResponseOfCategory", "Forum") %>
        <% var parents = Model.responses.Where(p => p.p_id == null || p.p_id == 0).ToList().OrderBy(p => p.id);
           int j = 1;
           foreach (var item in parents)
           {
        %>
        <p class="haster">
            <a href="javascript:ShowList(<%= j %> )">הראה/הסתר שירשור </a>
        </p>
        <ul class="forum" id="<%= j%>" style="display: block">
            <li>
                <%if (item.publish == 1)
                  { %>
                <h5>
                    <% Response.Write("<a href=\"javascript:ShowText(" + item.id + ")\">" + item.title + "</a>"); %></h5>
                <%
                    if (string.IsNullOrEmpty(item.text.Trim()))
                    { %>
                (ל"ת)
                <%} %>
                <p id="text<%= item.id %>" style="display: none">
                    <%= item.text%>
                    <br />
                    <br />
                    <% if (!string.IsNullOrEmpty(item.image))
                       { %>
                    <img src="<%= item.image %>" />
                    <%} %>
                    <% 
                        if (!string.IsNullOrEmpty(item.movie))
                        {
                    %>
                    <%= item.movie %>
                    <%} %>
                </p>
                <span class="forumName"><b>
                    <%= item.name%></b>,
                    <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(item.date, true)%></span>
                <span class="tguva1">
                    <%= Html.ActionLink("הוסף תגובה", "CreateResponse1", "Forum", new { id = item.id }, null)%></span>
                <%}
                  else
                  { %>
                <span class="husar">התגובה הוסרה!</span>
                <%} %>
                <ul>
                    <%foreach (var res in Model.responses.Where(p => p.p_id == item.id))
                      { %>
                    <li>
                        <%if (res.publish == 1)
                          { %>
                        <h5>
                            <% Response.Write("<a href=\"javascript:ShowText(" + res.id + ")\">" + res.title + "</a>"); %></h5>
                        <%
                            if (string.IsNullOrEmpty(item.text.Trim()))
                            { %>
                        (ל"ת)
                        <%} %>
                        <div id="text<%= res.id %>" style="display: none">
                            <%= res.text%>
                            <br />
                            <br />
                            <% if (!string.IsNullOrEmpty(res.image))
                               { %>
                            <img src="<%= res.image %>" />
                            <%} %>
                            <% if (!string.IsNullOrEmpty(res.movie))
                               { %>
                            <%= res.movie %>
                            <%} %>
                        </div>
                        <span class="forumName"><b>
                            <%= res.name%></b>,
                            <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(res.date, true)%></span>
                        <span class="tguva1">
                            <%= Html.ActionLink("הוסף תגובה", "CreateResponse1", "Forum", new {id = res.id }, null)%>
                        </span>
                        <%}
                          else
                          { %>
                        <span class="husar">התגובה הוסרה!</span>
                        <%} %>
                        <ul>
                            <%foreach (var res1 in Model.responses.Where(p => p.p_id == res.id))
                              { %>
                            <li>
                                <%if (res1.publish == 1)
                                  { %>
                                <h5>
                                    <% Response.Write("<a href=\"javascript:ShowText(" + res1.id + ")\">" + res1.title + "</a>"); %></h5>
                                <%
                                    if (string.IsNullOrEmpty(item.text.Trim()))
                                    { %>
                                (ל"ת)
                                <%} %>
                                <div id="text<%= res1.id %>" style="display: none">
                                    <%= res1.text%>
                                    <br />
                                    <br />
                                    <% if (!string.IsNullOrEmpty(res1.image))
                                       { %>
                                    <img src="<%= res1.image %>" />
                                    <%} %>
                                    <% if (!string.IsNullOrEmpty(res1.movie))
                                       { %>
                                    <%= res1.movie %>
                                    <%} %>
                                </div>
                                <span class="forumName"><b>
                                    <%= res1.name%></b>,
                                    <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(res1.date, true)%></span>
                                <span class="tguva1">
                                    <%= Html.ActionLink("הוסף תגובה", "CreateResponse1", "Forum", new {id = res1.id}, null)%></span>
                                <%}
                                  else
                                  { %>
                                <span class="husar">התגובה הוסרה!</span>
                                <%} %>
                                <ul>
                                    <%foreach (var res2 in Model.responses.Where(p => p.p_id == res1.id))
                                      { %>
                                    <li>
                                        <%if (res2.publish == 1)
                                          { %>
                                        <h5>
                                            <% Response.Write("<a href=\"javascript:ShowText(" + res2.id + ")\">" + res2.title + "</a>"); %></h5>
                                        <%
                                            if (string.IsNullOrEmpty(item.text.Trim()))
                                            { %>
                                        (ל"ת)
                                        <%} %>
                                        <div id="text<%= res2.id %>" style="display: none">
                                            <%= res2.text%>
                                            <br />
                                            <br />
                                            <% if (!string.IsNullOrEmpty(res2.image))
                                               { %>
                                            <img src="<%= res2.image %>" />
                                            <%} %>
                                            <% if (!string.IsNullOrEmpty(res2.movie))
                                               { %>
                                            <%= res2.movie %>
                                            <%} %>
                                        </div>
                                        <span class="forumName"><b>
                                            <%= res2.name%></b>,
                                            <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(res2.date, true)%></span>
                                        <span class="tguva1">
                                            <%= Html.ActionLink("הוסף תגובה", "CreateResponse1", "Forum", new {id = res2.id }, null)%></span>
                                        <%}
                                          else
                                          { %>
                                        <span class="husar">התגובה הוסרה!</span>
                                        <%} %>
                                        <ul>
                                            <%foreach (var res3 in Model.responses.Where(p => p.p_id == res2.id))
                                              { %>
                                            <li>
                                                <%if (res3.publish == 1)
                                                  { %>
                                                <h5>
                                                    <% Response.Write("<a href=\"javascript:ShowText(" + res3.id + ")\">" + res3.title + "</a>"); %></h5>
                                                <%
                                                    if (string.IsNullOrEmpty(item.text.Trim()))
                                                    { %>
                                                (ל"ת)
                                                <%} %>
                                                <div id="text<%= res3.id %>" style="display: none">
                                                    <%= res3.text%>
                                                    <br />
                                                    <br />
                                                    <% if (!string.IsNullOrEmpty(res3.image))
                                                       { %>
                                                    <img src="<%= res3.image %>" />
                                                    <%} %>
                                                    <% if (!string.IsNullOrEmpty(res3.movie))
                                                       { %>
                                                    <%= res3.movie %>
                                                    <%} %>
                                                </div>
                                                <span class="forumName"><b>
                                                    <%= res3.name%></b>,
                                                    <%=nelech.Views.Shared.Code.Utils.GetHebrewJewishDateString(res3.date, true)%></span>
                                                <%}
                                                  else
                                                  { %>
                                                <span class="husar">התגובה הוסרה!</span>
                                                <%} %>
                                            </li>
                                            <%}%>
                                        </ul>
                                    </li>
                                    <%}%>
                                </ul>
                            </li>
                            <%}%>
                        </ul>
                    </li>
                    <%}%>
                </ul>
            </li>
            <% j++; %></ul>
        <% } %>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="publishTop" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Right" runat="server">
</asp:Content>
